package com.lzx.makeFriend.controller.web;

import com.lzx.common.utils.R;
import com.lzx.makeFriend.entity.Invite;
import com.lzx.makeFriend.service.InviteService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author 程序员星星
 * @date 2023/1/3
 * @Description
 */
@RestController
@RequestMapping("/makeFriend/invite/web")
public class WebInviteController {
    @Resource
    private InviteService inviteService;

    //用户同意或拒绝邀请
    @PutMapping("/isAgreeInvite/{id}/{isAgree}")
    public R isAgreeInvite(@PathVariable Long id, @PathVariable int isAgree) {
        return inviteService.isAgreeInvite(id, isAgree);
    }

    //获取当前用户收到的好友邀请
    @GetMapping("/getInviteList/{userId}/{current}/{size}")
    public R getInviteList(@PathVariable int userId, @PathVariable int current, @PathVariable int size) {
        return inviteService.getInviteList(userId, current, size);
    }

    //获取推荐邀请列表
    @GetMapping("/getRecommendList/{userId}")
    public R getRecommendList(@PathVariable int userId) {
        return inviteService.getRecommendList(userId);
    }

    //邀请用户回答问题
    @PostMapping("/inviteUser")
    public R inviteUser(@RequestBody Invite invite) {
        return inviteService.inviteUser(invite);
    }
}
